package com.itheima.health.job;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.health.service.OrderSettingService;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

@Component
public class ClearOverOrderDateJob {

    @Reference
    private OrderSettingService oderSettingService;



    /**
     * 清理过期过期预约设置表
     */
    public void clearOverOrderDate(){
        //1.优先写出cron表达式
        //0 0 2 L * ?
        //2.配置application-jobs.xml ，配置自定义Job、任务描述、触发器、调度工厂等
        //3.new Date用 SimpleDateFormat 转化为("yyyy-MM-dd")的格式
        String orderDate="2019-03-10";
        SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
        /*String orderDate = sdf.format(new Date());*/
        //4.调用OrdersettingService删除日期数组
        oderSettingService.clearOverOrderDate(orderDate);
    }
}
